# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models

class Migration(SchemaMigration):

    def forwards(self, orm):
        
        # Adding model 'ExtendedFlatPage'
        db.create_table('smart_extendedflatpage', (
            ('flatpage_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['flatpages.FlatPage'], unique=True, primary_key=True)),
            ('show_after', self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='flatpage_predecessor', null=True, blank=True, to=orm['smart.ExtendedFlatPage'])),
            ('child_of', self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='flatpage_parent', null=True, blank=True, to=orm['smart.ExtendedFlatPage'])),
        ))
        db.send_create_signal('smart', ['ExtendedFlatPage'])

        # Adding model 'FlatpageNav'
        db.create_table('smart_flatpagenav', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('menu', self.gf('django.db.models.fields.TextField')()),
        ))
        db.send_create_signal('smart', ['FlatpageNav'])

        # Adding M2M table for field flatpages on 'FlatpageNav'
        db.create_table('smart_flatpagenav_flatpages', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('flatpagenav', models.ForeignKey(orm['smart.flatpagenav'], null=False)),
            ('flatpage', models.ForeignKey(orm['flatpages.flatpage'], null=False))
        ))
        db.create_unique('smart_flatpagenav_flatpages', ['flatpagenav_id', 'flatpage_id'])


    def backwards(self, orm):
        
        # Deleting model 'ExtendedFlatPage'
        db.delete_table('smart_extendedflatpage')

        # Deleting model 'FlatpageNav'
        db.delete_table('smart_flatpagenav')

        # Removing M2M table for field flatpages on 'FlatpageNav'
        db.delete_table('smart_flatpagenav_flatpages')


    models = {
        'flatpages.flatpage': {
            'Meta': {'ordering': "('url',)", 'object_name': 'FlatPage', 'db_table': "'django_flatpage'"},
            'content': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'enable_comments': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'registration_required': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'sites': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['sites.Site']", 'symmetrical': 'False'}),
            'template_name': ('django.db.models.fields.CharField', [], {'max_length': '70', 'blank': 'True'}),
            'title': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
            'url': ('django.db.models.fields.CharField', [], {'max_length': '100', 'db_index': 'True'})
        },
        'sites.site': {
            'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
            'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
        },
        'smart.extendedflatpage': {
            'Meta': {'ordering': "('url',)", 'object_name': 'ExtendedFlatPage', '_ormbases': ['flatpages.FlatPage']},
            'child_of': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'flatpage_parent'", 'null': 'True', 'blank': 'True', 'to': "orm['smart.ExtendedFlatPage']"}),
            'flatpage_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['flatpages.FlatPage']", 'unique': 'True', 'primary_key': 'True'}),
            'show_after': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'flatpage_predecessor'", 'null': 'True', 'blank': 'True', 'to': "orm['smart.ExtendedFlatPage']"})
        },
        'smart.flatpagenav': {
            'Meta': {'object_name': 'FlatpageNav'},
            'flatpages': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['flatpages.FlatPage']", 'symmetrical': 'False'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'menu': ('django.db.models.fields.TextField', [], {}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'})
        }
    }

    complete_apps = ['smart']
